using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;

namespace OsdmSoftware.PocketPicture
{
    static class Program
    {
        public static PocketPictureForm MainForm;
        public static Exception UnhandledException = null;

        static void RecoveryProc()
        {
            RecoveryForm ad = new RecoveryForm();
            try
            {
                Application.Run(ad);
            }
            catch
            {
            }
        }

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
#if PocketPC
        [MTAThread]
#else
        [STAThread]
#endif
        static void Main()
        {
#if !PocketPC
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#endif
            MainForm = new PocketPictureForm();
            try
            {
                Application.Run(MainForm);
            }
            catch (Exception e)
            {
                UnhandledException = e;
                Thread t = new Thread(new ThreadStart(RecoveryProc));
                t.Start();
                t.Join();
            }
        }
    }
}